function [beta, pval] = f_first_pass(r, g)

[T, nta] = size(r);
[T, ng]  = size(g);

beta     = nan(nta, 1+ng);
pval     = nan(nta, 1+ng);

nwlags   = round((4*(T/100)).^(2/9));

for i = 1:nta
    
    iota   = ones(T, 1);     
    res    = nwest(r(:, i), [iota g], nwlags);
    tstat  = res.tstat;
    beta(i, :)   = res.beta(:);
    pval(i, :)   = f_pval2S(tstat, nta-(1+ng))';
    
end